<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title th:if="${college.collegeId == null}">新增学院</title>
    <title th:unless="${college.collegeId == null}">编辑学院</title>

    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f9f9f9;
            margin: 0;
            padding: 20px;
        }

        .container {
            max-width: 500px;
            margin: 0 auto;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
        }

        h2 {
            color: #333;
            text-align: center;
            margin-bottom: 20px;
        }

        .form-group {
            margin-bottom: 15px;
        }

        label {
            display: block;
            font-weight: bold;
            margin-bottom: 5px;
        }

        input[type="text"],
        input[type="hidden"] {
            width: 100%;
            padding: 8px;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-sizing: border-box;
        }

        .btn {
            padding: 10px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            color: white;
            text-decoration: none;
            display: inline-block;
            margin-right: 10px;
        }

        .btn-primary {
            background-color: #007bff;
        }

        .btn-secondary {
            background-color: #6c757d;
        }

        .btn:hover {
            opacity: 0.9;
        }

        .button-group {
            margin-top: 20px;
        }
    </style>
</head>
<body>

<div class="container">
    <!-- 动态标题 -->
    <h2>
        <span th:if="${college.collegeId == null}">新增学院</span>
        <span th:unless="${college.collegeId == null}">编辑学院</span>
    </h2>

    <!-- 表单 -->
    <form th:action="${college.collegeId == null ? '/college/add' : '/college/update'}" method="post">
        <!-- 隐藏字段 -->
        <input type="hidden" name="collegeId" th:value="${college.collegeId}" />

        <div class="form-group">
            <label for="collegeName">学院名称</label>
            <input type="text" id="collegeName" name="collegeName"
                   th:value="${college.collegeName}" required />
        </div>

        <div class="button-group">
            <button type="submit" class="btn btn-primary">保存</button>
            <a th:href="@{/college/}" class="btn btn-secondary">取消</a>
        </div>
    </form>

</div>

</body>
</html>
